//显示首页天气
function initWeather(){

	
	//查询是否有设置默认城市，如果没有设置就查询ip所在的城市显示
	var weather_city_list = $.GetConfigValue("weather_city_list","");
	if(weather_city_list!=="")
	{
		var myCity = weather_city_list.split(',')[0];
		if(myCity)
		{
			echoWeather(myCity);
		}
		
	}
	else
	{
		$.getScript("http://j.maxmind.com/app/geoip.js",echoWeather);
	}
	
	
	
}

function echoWeather(myCity)
{
	if(myCity==null)
	{
		myCity = geoip_city()==""?geoip_country_name():geoip_city();
	}
	loadCityData({name:myCity},function(city,data){
		
		
	var reg  = new RegExp("[^/\\\\]+$","g"); 
	var image =  reg.exec(data.current.image).toString();
	image = image.replace(".gif",".png");
	
	
	var con = '';
	con += '<img src="'+PAGE_PATH+'images/weather/'+image+'"/>';
	con += '<div class="city">'+city.name+'</div>';
	con += ' <div class="info">'+data.current.condition+'</div>';
	con += '<div class="temperature">'+data.current.temp+'</div>';
	$('#temBox').html(con);
	})

}